package com.lagou.edu.controller;

import com.lagou.edu.service.ResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/resume")
public class ResumeController {

    /**
     * 获取服务的端口号
     */
    @Value("${server.port}")
    private Integer port;

    @Autowired
    private ResumeService resumeService;
    //"/resume/openstate/1545132"
    @GetMapping("/openstate/{userId}")
    public Integer findDefaultResumeState(@PathVariable Long userId) {

        // 模拟处理超时
     /*   try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }*/
        //return resumeService.findDefaultResumeByUserId(userId).getIsOpenResume();
        System.out.println("====>>>>>>>>>>>>>>我是8080，访问到我这里了......");
        return port;
    }


    /**
     * 测试ribbon负载均很
     * @return
     */
    @GetMapping("/ribbon")
    public Integer testRibbonSLB() {
        // 返回端口号
        return port;
    }
}
